import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import PersonalCenterView from '@/views/PersonalCenterView.vue'
import SearchResultView from '@/views/SearchResultView.vue';
import SearchDetailsView from '@/views/SearchDetailsView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "home",
      component: HomeView,
    },
    {
      path: "/personalCenter",
      name: "personalCenter",
      component: PersonalCenterView,
      children: [
        {
          // 收藏
          path: "collect",
          name: "collect",
          component: () =>
            import("@/views/components/personalCenter/Collect.vue"),
        },
        {
          //历史
          path: "history",
          name: "history",
          component: () =>
            import("@/views/components/personalCenter/History.vue"),
        },
        {
          //设置
          path: "setting",
          name: "setting",
          component: () =>
            import("@/views/components/personalCenter/Setting.vue"),
        },
        {
          //文章管理
          path: "manageArticles",
          name: "manageArticles",
          component: () =>
            import("@/views/components/personalCenter/ManageArticles.vue"),
        },
        {
          //文章发布
          path: "publishArticles",
          name: "publishArticles",
          component: () =>
            import("@/views/components/personalCenter/PublishArticles.vue"),
        },
        {
          //创作者认证
          path: "creatorCertification",
          name: "creatorCertification",
          component: () => 
            import("@/views/components/personalCenter/CreatorCertification.vue"),
        },
      ],
    },
    {
      path: "/searchResult",
      name: "searchResult",
      component: SearchResultView,
    },
    {
      path: "/searchDetails",
      name: "searchDetails",
      component: SearchDetailsView,
    },
    // {
    // path: '/about',
    // name: 'about',
    // // route level code-splitting
    // // this generates a separate chunk (About.[hash].js) for this route
    // // which is lazy-loaded when the route is visited.
    // component: () => import('../views/AboutView.vue'),
    // },
  ],
});

export default router
